Think Java by Allen B. Downey & Chris Mayfield

Think Java by Allen B. Downey & Chris Mayfield

Author:Allen B. Downey & Chris Mayfield
Language: eng
Format: epub
Publisher: O'Reilly Media, Inc.
Published: 2016-05-24T16:00:00+00:00


Methods like maxInRange can be awkward to use. To find the largest element in an array, we have to provide the range for the entire array.

double max = maxInRange(a, 0, a.length - 1);

Write a method called max that takes an array and uses maxInRange to find and return the largest element.

Chapter 9. Strings and Things

In Java and other object-oriented languages, an object is a collection of data that provides a set of methods. For example, Scanner, which we saw in “The Scanner Class”, is an object that provides methods for parsing input. System.out and System.in are also objects.

Strings are objects, too. They contain characters and provide methods for manipulating character data. We explore some of those methods in this chapter.

Not everything in Java is an object: int, double, and boolean are so-called primitive types. We will explain some of the differences between object types and primitive types as we go along.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.